<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        function getId() {
            const list = [];
            const range = '0123456789abcdefghijklmnopqrstuvwxyz';
            for (let i = 0; i < 12; i++) {
                list[i] = range.substr(Math.floor(Math.random() * 0x10), 1);
            }
            list[5] = range.substr((list[5] & 0x3) | 0x8, 1);
            const uuid = list.join('');
            return uuid;
        }
        //2.调用
        let obj = {
            id: this.getId()
            
        }
        console.log(this.getId());
    </script>
</body>

</html>